<template>
	<view class="app-container">
		<uni-section title="点击卡片跳转到成员b站空间" type="line">
		</uni-section>
		<uni-card @click="toBilibili(v)" v-for="(v,i) in user_list" :key="i" :title="v.nickname"
			:sub-title="v.group_name" :extra="v.state_name" :thumbnail="getImg(v.avatar)">
			<view>QQ:{{v.qq}}</view>
			<view>b站uid:{{v.bilibili_uid}}</view>
		</uni-card>
		<uni-pagination :show-icon="true" :total="total" :current="page" @change="changePage" />
	</view>
</template>

<script>
	import indexApi from "@/api/indexApi.js";
	import {
		getImg
	} from "@/api/helpFunc.js";

	export default {
		data() {
			return {
				user_list: [],
				page: 1,
				limit: 10,
				total: 0,
				getImg: getImg
			}
		},
		onLoad() {
			this.listMember();
		},
		methods: {
			toBilibili(v) {
				let uid = v.bilibili_uid;
				let url = "https://space.bilibili.com/" + uid;
				uni.navigateTo({
					url: '/pages/common/webview?url=' + url
					// page.json定义的路径 传url 到webview界面去接收 实现跳转
				});
			},
			async changePage(e) {
				this.page = e.current;
				await this.listMember();
			},
			async listMember() {
				let param = {
					page: this.page,
					limit: this.limit
				};
				let res = await indexApi.listMember(param);
				this.user_list = [...res.data];
				this.total = res.count;
			}
		}
	}
</script>

<style>

</style>